﻿Imports DTO
Imports System.Data.SqlClient


Public Class ChiTietPhieuMuon_DAO
    Public Shared Function loadCTPhieuMuon(ByVal mamuon As Integer) As DataTable
        Dim dt As New DataTable
        Dim con As SqlConnection = DataProvider.ConnectToDB
        Dim cmd As New SqlCommand
        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = "ChiTietPhieuMuon_GetInfoDauSach"
        cmd.Connection = con

        Dim para As New SqlParameter("mamuon", SqlDbType.Int)
        para.Direction = ParameterDirection.Input
        para.Value = mamuon
        cmd.Parameters.Add(para)

        Dim adapter As New SqlDataAdapter(cmd)
        adapter.Fill(dt)
        con.Close()

        Return dt
    End Function

    Public Shared Function loadInfoCTPhieuMuon_PhieuMuon(ByVal mamuon As Integer, ByVal madausach As Integer) As DataTable
        Dim dt As New DataTable
        Dim con As SqlConnection = DataProvider.ConnectToDB
        Dim cmd As New SqlCommand
        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = "ChiTietPhieuMuon_PhieuMuon_GetInfoForPhieuTra"
        cmd.Connection = con

        Dim para As New SqlParameter("mamuon", SqlDbType.Int)
        para.Direction = ParameterDirection.Input
        para.Value = mamuon
        cmd.Parameters.Add(para)

        para = New SqlParameter("madausach", SqlDbType.Int)
        para.Direction = ParameterDirection.Input
        para.Value = madausach
        cmd.Parameters.Add(para)

        Dim adapter As New SqlDataAdapter(cmd)
        adapter.Fill(dt)
        con.Close()

        Return dt
    End Function
End Class
